<h3 align = 'center'>FACILITIES IN <?php echo $room;?></h3>
<form action = "<?=$base_url ?>pfmis/problem/addproblem" method = 'POST'>
<?php
    $this->load->database();
    $nameListQ = 'SELECT DISTINCT FacilityName FROM pf_facilities WHERE RoomAssigned = \''.$room.'\' AND Status = \'1\'';
    $nameListR = $this->db->query($nameListQ);
    if($nameListR->num_rows() > 0)
    {
        echo '<table align = "center"><tr><td align = "right">Facility Name:</td><td><select name = "item">';
        foreach($nameListR->result() as $nameList)
        {
            $getTypeQ = 'SELECT FacilityType FROM pf_facilities WHERE FacilityName = \''.$nameList->FacilityName.'\'';
            $getTypeR = $this->db->query($getTypeQ);
            $getType = $getTypeR->result();
            echo '<option>'.$nameList->FacilityName.' - '.$getType[0]->FacilityType.'</option>';
        }
        echo '</select></td></tr>
            <tr>
                <td align = "right">Damage Description:</td>
                <td><input type = "text" name = "desc"></td>
            </tr>
            <tr>
                <td align = "right"><input type = "radio" name = "repair" id = "repair">REPAIRABLE</td>
                <td align = "right"><input type = "radio" name = "norepair" id = "repair">IRREPAIRABLE</td>
            </tr>
            <tr>
                <td colspan = 2 align = "center"><input type = "submit" value = "REPORT PROBLEM"></td>
            </tr>';
        echo '</table>';
    }
    else
    {
        echo '<h3 align = "center">all facilities are not available</h3>';
    }
?>
</form>